clc
clear all
%Experiment 1
    
    %Theoretical
        %bandPassF = [1 1.6 2.5 5 7.5 10 16 25 50 75 100 160 250 500 750
        %1000 1600 2500 5000 7500 10000 16000 25000 50000 75000];
        bandPassF = [1 1.6 2.5 5 7.5 10 16 25 50 75 100 160 250 500 750 1000 1600 2500 5000 7500 10000 16000];
        bandPassW=bandPassF*pi*2;
        bandPassW=bandPassF*pi*2;
        bandPassS=bandPassW.*i;
        Z1=1000+(10^6)./bandPassS;
        Z2=(10^6)./(bandPassS+10^3);
        
        %bandPassH=(10^3).*bandPassS./((bandPassS.^2)+(3*10^3).*bandPassS+10^6)
        bandPassH=Z2./(Z1+Z2);
        bandPassHdbMagTheoryDB=20*log10(abs(bandPassH));
        bandPassHdbPhaseTheory=angle(bandPassH);




    %Actual
        bandPassHdbMagActualDB=[-38.4 -34.9 -33.9 -28.9 -26.1 -23.4 -17.9 -16.3 -12 -10.6 -9.9 -9.4 -9.9 -12.1 -14.5 -16.4 -19.9 -23.5 -29 -32 -34 -36.5];

            
    %Plot
       figure(1)
       subplot(2,1,1)
       semilogx(bandPassF,bandPassHdbPhaseTheory,'g');
       title('Frequency Response of BandPass Circuit: Phase');
       xlabel('Frequency in Hz');
       ylabel('Phase Delay in Rad/s');
       grid on
       subplot(2,1,2)
       semilogx(bandPassF,bandPassHdbMagTheoryDB)
       grid on
       hold on
       semilogx(bandPassF,bandPassHdbMagActualDB,'r')
       title('Frequency Response of BandPass Circuit: Magnitude');
       xlabel('Frequency in Hz');
       ylabel('Magnitude gain in dB');
       hold off
       


%Experiment 2

    %Theoretical
        unityBandPassH=3.*bandPassH;
        unityBandPassHdbMagTheoryDB=20*log10(abs(unityBandPassH));
        unityBandPassHdbPhaseTheory=angle(unityBandPassH);


    %Actual
	unityBandPassHdbMagActualDB=[-32.8 -28.4 -25.8 -20 -16.9 -14.1 -9.7 -6.8 -2.6 -0.9 -0.2 0.4 -0.2 -2.5 -5 -6.7 -10 -14 -19.8 -23.6 -25.5 -29.3];

    
    %Plot
       figure(2)
       subplot(2,1,1)
       semilogx(bandPassF,unityBandPassHdbPhaseTheory,'g');
       title('Frequency Response of Unity BandPass Circuit: Phase');
       xlabel('Frequency in Hz');
       ylabel('Phase Delay in Rad/s');
       grid on
       subplot(2,1,2)
       semilogx(bandPassF,unityBandPassHdbMagTheoryDB)
       grid on
       hold on
       semilogx(bandPassF,unityBandPassHdbMagActualDB,'r')
       title('Frequency Response of Unity BandPass Circuit: Magnitude');
       xlabel('Frequency in Hz');
       ylabel('Magnitude gain in dB');
       hold off
    

%Experiment 3


    %Theoretical



    %Actual

